package com.itheima.day08_HomeWork;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class ThreeGuo {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, "刘备字玄德","诸葛亮字孔明","曹操字孟德",
                "孙权字仲谋","关羽字云长","张飞字翼德","赵云字子龙","乐进字文谦","李典字曼成",
                "曹仁字子孝","曹洪字子廉");
        Map<String, String> map = list.stream().map(s -> s.split("字")).collect(Collectors.toMap(s -> s[0], s -> s[1]));
//        HashMap<String, String> map = new HashMap<>();
//        for (String s : list) {
//            String[] split = s.split("字");
//            map.put(split[0], split[1]);
//        }
        System.out.println(map);
    }
}
